package main

import (
	"fmt"
	"io/ioutil"
	//	"io"
	"bytes"
	"encoding/json"
	"net/http"
	"os"
)

func main() {
	song := make(map[string]interface{})
	song["verifyType"] = "4"
	song["name"] = "谢捷峰"
	song["mobile"] = "13818433711"
	song["expire"] = "5"
	bytesData, err := json.Marshal(song)
	if err != nil {
		fmt.Println(err.Error())
		return
	}
	reader := bytes.NewReader(bytesData)
	req, err := http.NewRequest("POST", "http://10.42.0.59/cango-sms/sendIdentifierSMS", reader)

	req.Header.Add("Authorization", "hnNFbJBR")
	req.Header.Add("Content-Type", "application/json;charset=UTF-8")
	client := &http.Client{
	//...
	}
	resp, err := client.Do(req)
	if err != nil {
		fmt.Println(err.Error())
		return
	}
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		fmt.Println(err.Error())
		return
	}
	fmt.Println(string(body))
}

func checkError(err error) {
	if err != nil {
		fmt.Fprintf(os.Stderr, "Fatal error: %s", err.Error())
	}
}
